-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update the cache used for LatestRoundRequested #503
Conversation
@@ -133,9 +134,8 @@ func (c *transmissionsCache) LatestRoundRequested( | |||
c.tdLock.RLock() | |||
defer c.tdLock.RUnlock() | |||
configDigest = c.transmissionDetails.Digest | |||
epoch = c.transmissionDetails.Epoch | |||
round = c.transmissionDetails.Round | |||
err = c.assertTransmissionsNotStale() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got rid of the error check because we don't actually care what the config digest is and asserting an error would actually cause you to transmit more rounds
c.tdLock.RLock() | ||
defer c.tdLock.RUnlock() | ||
configDigest = c.transmissionDetails.Digest | ||
epoch = c.transmissionDetails.Epoch | ||
round = c.transmissionDetails.Round | ||
err = c.assertTransmissionsNotStale() | ||
epoch = 0 | ||
round = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the changes look fine - but why is LatestRoundRequested
implemented in two places? it seems very easy to make changes in one place but forget to make changes in the other
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
originally i think it was to have a cached response and save time. libocr uses the transmissions_cache to satisfy the ContractTransmitter
interface.
now that we know we can always return 0 I think we don't need the underlying method. i'll edit that out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wait, actually the Reader needs to implement it because it must conform to the interface was well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i removed the need to query the chain and to use the lock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess my suggestion is - instead of having zero values implemented twice, why not just call c.reader.LatestRoundRequested
and add a note saying that this will always return zero values?
that way you only have hard-coded values in one place rather than two places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh i see what you mean. will do 👍
Quality Gate failedFailed conditions |
No description provided.